package com.parkreport.report.action;

import javax.xml.rpc.ServiceException;

import org.jfree.data.time.Year;

import com.common.report.vo.ReportTableViewVO;
import com.common.util.StringUtil;
import com.parkreport.base.BaseAction;
import com.parkreport.report.service.YearToYearCarReportService;
import com.parkreport.report.service.YearToYearPersonReportService;
import com.parkreport.vo.ReportParamVO;

public class YearToYearReportAction extends BaseAction {

	private YearToYearCarReportService carService = new YearToYearCarReportService();
	private YearToYearPersonReportService personService = new YearToYearPersonReportService();
	
	private ReportParamVO paramVO = new ReportParamVO();
	
	private ReportTableViewVO tableVO = new ReportTableViewVO();
	private String year;
	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String personCount(){
		try {
			if(StringUtil.isBlank(year)){
				year = new Year().toString();
			}
			personService.setYear(year);
			tableVO = personService.getTableViewVO(this.getRequest());
			tableVO.setMentName("景区名称");
			tableVO.setReportName(year+"年入境游客数与去年同比");
			this.getSession().setAttribute("tableVO", tableVO);
		} catch (ServiceException e) {
			log.error(e.getMessage(),e);
		}
		
		return topager("/pages/report/yeartoyear/person_list.jsp");
	}
	
	public String carCount(){
		
		try {
			if(StringUtil.isBlank(year)){
				year = new Year().toString();
			}
			carService.setYear(year);
			tableVO = carService.getTableViewVO(this.getRequest());
			tableVO.setMentName("景区名称");
			tableVO.setReportName(year+"年入境游客车辆数与去年同比");
			this.getSession().setAttribute("tableVO", tableVO);
		} catch (ServiceException e) {
			log.error(e.getMessage(),e);
		}
		
		return topager("/pages/report/yeartoyear/car_list.jsp");
	}
	
	
	//setter getter 
	public ReportParamVO getParamVO() {
		return paramVO;
	}

	public void setParamVO(ReportParamVO paramVO) {
		this.paramVO = paramVO;
	}

	
	


	public ReportTableViewVO getTableVO() {
		return tableVO;
	}

	public void setTableVO(ReportTableViewVO tableVO) {
		this.tableVO = tableVO;
	}

}
